<?php
return array(

	'attributeLabels' => array(
		'worker_id' => '用户',
		'worker.worker_name' => '用户',
		'logo' => '图标',
		'template'=>'模版',
		'host' => '域名',
		'status' => '状态',
		'desc' => '简介',
	),

	'attributeHints' => array(
		'logo' => '宽高最好为974 X 68',
		'thumb' => '宽高最好为66 X 58',
	),
	
	'rules'=>array(
		array(
			'logo,thumb', 'file',
			'allowEmpty' => true,
			'types'=>'jpg, gif, png',
			'maxSize'=>1024*1024*500,
			'tooLarge'=>'上传文件超过500KB，无法上传。'
		),
		array('host,template,worker_id','required'),
		array('host','url'),
		array('worker_id', 'unique', 'message' => '{attribute}已经添加过网站，不能再次添加！'),
	),

	'relations' => array(
		'worker'=>array(CActiveRecord::BELONGS_TO,'WorkerAccount','worker_id'),
	),
	'behaviors' => array(
		'userScope' => array(
			'class' => 'coms.behaviors.userScopes.DefaultScope',
			'relatedFields' => array(
				'worker_id',
			),
			'autoRun' => false,
		),
		'uidResolver' => array(
			'class' => 'coms.behaviors.AutoIdResolve',
			'uid' => 'worker_id'
		),
		'fileSaver' => array(
			'class' => 'lib.behaviors.ar.CFileSaveBehavior',
			'baseUrl' => Yii::app()->baseUrl . '/uploaded',
			'basePath' => dirname(Yii::app()->basePath) . '/uploaded',
			'attributes' => array('logo','thumb'),
		),
		'stateHandle' => array(
			'class' => 'ModelState',
			'handleField' => 'status',
			'configName' => 'status.mall.audit',
			'configReader' => Yii::app()->config,
			'initState' => 'ST_NONE',
		),
		'fornt' => array(
			'class' => 'coms.behaviors.FrontBehavior',
			'attributes' => array(
				'title' => 'name',
				'desc' => 'desc',
				'img' => 'logo'
			),
		),
	),
	'_import' => array(
		array('*', 'models.ActiveRecord//*'),
	),
);